();
String out = LOLA.sync_getVerificationOutput(modelCheckerExePath, modelToVerify, propertyToVerify, true);
boolean propertyVerified = false;
if(LOLA.isPropertyVerified(out)){
counterExampleTraceList.add(LOLA.getCounterExample(out, pn));
propertyVerified = true;
}
return formatResult("DEADLOCKS", !propertyVerified, counterExampleTraceList, pn, "Deadlock absence");
}
private String verifyAllDeadlocks(PetriNet pn) throws Exception{
if(pn.isEmpty())
throw new Exception("ERROR: The provided petri net is empty\nName:"+pn.getName());
ArrayList endPLList = pn.getEndList_safe();
String modelToVerify = ExporterLOLA.exportTo_LOLA(pn);
ArrayList counterExampleTraceList = new ArrayList();
boolean propertyVerified = false;
while(true){
String propertyToVerify = ExporterLOLA.exportTo_LOLA_property_DeadlockPresence(pn);
String out = LOLA.sync_getVerificationOutput(modelCheckerExePath, modelToVerify, propertyToVerify, true);
boolean deadlockPresent = LOLA.isPropertyVerified(out);
if(!deadlockPresent)
break;
propertyVerified = true;
String[] counterExample = LOLA.getCounterExample(out, pn);
counterExampleTraceList.add(counterExample);
String[] lastCounterExampleObjList = counterExample[counterExample.length-1].split(" ");
for(String lastCounterExampleObj: lastCounterExampleObjList)
if(!endPLList.contains(pn.getPlace(lastCounterExampleObj)))
pn.getPlace(lastCounterExampleObj).excludeFromDeadlockCheck=true;
}
return formatResult("DEADLOCKS", !propertyVerified, counterExampleTraceList, pn, "Deadlock absence (checking all deadlocks)");
}
private String verifyUnboundedness(PetriNet pn, boolean onlyEndPlaces) throws Exception{
if(pn.isEmpty())
throw new Exception("ERROR: The provided petri net is empty\nName:"+pn.getName());
String modelToVerify = ExporterLOLA.exportTo_LOLA(pn);
String[] propertyToVerifyList = ExporterLOLA.exportTo_LOLA_property_UnboundednessPresence(pn, onlyEndPlaces);
boolean propertyVerified = false;
ArrayList counterExampleTraceList = new ArrayList();
for(String propertyToVerify:propertyToVerifyList){
String out = LOLA.sync_getVerificationOutput(modelCheckerExePath, modelToVerify, propertyToVerify, true);
if(LOLA.isPropertyVerified(out)){
counterExampleTraceList.add(LOLA.getCounterExample(out, pn));
propertyVerified = true;
}
}
return formatResult("UNBOUNDEDNESS", !propertyVerified, counterExampleTraceList, pn, "Unboundedness absence "+((onlyEndPlaces)?"only on the ending events":"in all the model"));
}
private String formatResult(String verificationType, boolean propertyVerified, ArrayList counterExampleTraceList, PetriNet pn, String verificationDescription) throws Exception{
/*
..OK or KO..
..detailed description of the result..
...
...
...
*/
String status = (propertyVerified)?"OK":"KO";
String description = "The property \""+verificationDescription+"\" is "+((propertyVerified)?"TRUE!":"FALSE!");
String ret = ""+status+""+description+"";
for(String[] counterExampleTrace: counterExampleTraceList){
if(counterExampleTrace.length == 0)
continue;
ret += "";
for(int i=0; i";
String[] objList = counterExampleTrace[i].split(" ");
ArrayList objProcessed = new ArrayList();
for(String obj: objList){
if(pn.getPlace(obj)==null)
throw new Exception("ERROR: place " + obj + " not found");
String objId = pn.getPlace(obj).description;
String objName = pn.getPlace(obj).additionalInfoList.get("name");
if(objProcessed.contains(objId))
continue;
objProcessed.add(objId);
ret += "";
}
ret += "";
return ret;
}
/*
public static void main(String[] args) {
try {
//Document t = XMLUtils.getXmlDocFromString("");
//String a = (String)XMLUtils.execXPath(t.getDocumentElement(), "/test/@a", XPathConstants.STRING);
//a = XMLUtils.escapeXPathField(a);
//Node b = (Node)XMLUtils.execXPath(t.getDocumentElement(), "//*[@a="+a+"]", XPathConstants.NODE);
String bpmnUrl = "C:\\Users\\dfalcioni\\Desktop\\test\\EPBR-Coordinator\\LP_ME_ADOXX_MODELSET_22224\\20903.bpmn";
String bpmnModel = new String(IOUtils.readFile(bpmnUrl));
VerificationEngine engine = new VerificationEngine();
System.out.println(engine.verifyDeadlock(bpmnModel, false));
//System.out.println(engine.verifyUnboundedness(bpmnModel, true));
//System.out.println(engine.verifyObjectReachability(bpmnModel, "pTask1", false, true));
//System.out.println(engine.verifyPathExistence(bpmnModel, "StartEvent_1", "pTask1", false, false, true));
} catch (Exception e) {
e.printStackTrace();
}
}
*/
}